#ifndef CONCURRENTLEPPBISECTION_H_
#define CONCURRENTLEPPBISECTION_H_

#include "leppbisection.h"
#include "../../geom/threadsafetriangle.h"
#include <QtCore/QMutex>

class ConcurrentLeppBisection : public LeppBisection
{
protected:
	mutable QMutex mutex;
	QMap<ThreadSafeTriangle *,bool> work_set;

	void processMeshPart(int offset,int size);
	void processItem(QMap<ThreadSafeTriangle *,bool>::iterator &i);
	void refineTriangle(ThreadSafeTriangle *t, ThreadSafeTriangle *u);
	void processTriangle(ThreadSafeTriangle *t);
	void removeFromPending(ThreadSafeTriangle *t);
public:
	ConcurrentLeppBisection(Mesh *m,SelectionCriterion *c);
	virtual ~ConcurrentLeppBisection();
	virtual void processMesh();
	int getDone();
};

#endif /*CONCURRENTLEPPBISECTION_H_*/
